﻿using System;
using System.Collections.Generic;
using System.Text;
using Word = Microsoft.Office.Interop.Word;

namespace TemplateAddIn
{
    public class ImageVariable : Variable
    {
        public override bool SetContent(object pContent)
        {
            this.content = (Word.ContentControl)pContent;

            RaiseContentChanged();

            return true;
        }

        protected override void Variable_ContentChanged(Variable sender)
        { 
            ((Word.ContentControl)this.content).Range.Copy();

            foreach (Word.ContentControl cc in this.ContentControlList)
            {
                cc.Range.Paste();
            }
        }

        public ImageVariable(string pName) : base(pName, Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlPicture) { }

        public override string FullName
        {
            get { return "Var(Image): " + this.Name; }
        }
    }
}
